package com.shareppy.nomrnaui.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;

public class PreferencesUtil {

	public static void putPreference(Context context, String key, String value) {
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		Editor edit = prefs.edit();
		edit.putString(key, value);
		edit.commit();
	}

	public static void putPreference(Context context, String key, int value) {
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		Editor edit = prefs.edit();
		edit.putInt(key, value);
		edit.commit();
	}

	public static String getPreference(Context context, String key,
			String ifNoSetValue) {
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		return prefs.getString(key, ifNoSetValue);
	}
	

	public static void cleanPreferences(Context context, String... keys) {
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		Editor edit = prefs.edit();
		for (String key : keys) {
			edit.remove(key);
		}
		edit.commit();
	}
}